﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

#nullable disable

namespace Faser_Shop.Models.Database
{
    public partial class Order
    {
        public Order()
        {
            OrderDetails = new HashSet<OrderDetail>();
        }

        [Key]
        [Column("OrderID")]
        public int OrderId { get; set; }
        [Column("UserID")]
        public int? UserId { get; set; }
        [Column(TypeName = "decimal(18, 2)")]
        public decimal? OrderTotalPrice { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? PaymentTime { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? ShippingTime { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? DeliveryTime { get; set; }
        [Column("TrackingID")]
        public int? TrackingId { get; set; }

        [ForeignKey(nameof(TrackingId))]
        [InverseProperty(nameof(LogisticsRecord.Orders))]
        public virtual LogisticsRecord Tracking { get; set; }
        [ForeignKey(nameof(UserId))]
        [InverseProperty("Orders")]
        public virtual User User { get; set; }
        [InverseProperty(nameof(OrderDetail.Order))]
        public virtual ICollection<OrderDetail> OrderDetails { get; set; }
    }
}
